const {
	http
} = uni.$u
// 客户列表---缺少搜索

const memberlist = (data) => {
	return http.get(
		`admin/member?page=${data.page}&perPage=${data.perPage}&name=${data.name}`
	)
}
// 关联销售（管理员账户模块）
const accountlist = () => {
	return http.get(`admin/account`)
}

// 风控等级（等级管理模块）
const levelist = () => {
	return http.get(`admin/level`)
}
// 创建会员
const addMember = (data) => {
	return http.post(`admin/member`, data)
}
// 获取会员详情
const getMemberDetails = (id) => {
	return http.get(`admin/member/${id}`)
}
/**
 * 修改：开启或者关闭状态
 * admin/member/2/status/1
 * 第一个入参是id，第二个入参是状态
 */
const amendState = (id, newStatus) => {
	return http.post(`admin/member/${id}/status/${newStatus}`)
}

/**
 * 修改：风险等级
 * admin/member/{id}/level{levelId}
 * 第一个入参是id，第二个入参是风险等级的id
 */
const amendGrade = (id, risk_level_id) => {
	return http.post(`admin/member/${id}/level/${risk_level_id}`)
}
/**
 * 修改：更换销售
 * admin/member/{oldSaleId}/change{levelId}
 * 第一个入参是id，第二个入参是风险等级的id
 */
const amendMarket = (oldSaleId, levelId) => {
	return http.post(`admin/member/${oldSaleId}/change/${levelId}`)
}


export {
	memberlist,
	accountlist,
	levelist,
	addMember,
	getMemberDetails,
	amendState,
	amendGrade,
	amendMarket
}